//
//  UIBarButtonItem+Extension.swift
//  WBDemo
//
//  Created by Meng on 16/12/19.
//  Copyright © 2016年 demo. All rights reserved.
//

import UIKit

extension UIBarButtonItem {
    convenience init(imageName: String, target: Any?, action: Selector) {
        
        let btn = UIButton()
        btn.setImage(UIImage(named: imageName), for: .normal)
        btn.setImage(UIImage(named: imageName + "_highlighted"), for: .highlighted)
        btn.addTarget(target, action: action, for: .touchUpInside)
        btn.sizeToFit()
        
        self.init(customView: btn)
        
    }
}
